<%-- 
    Document   : Admin
    Created on : Dec 18, 2014, 3:09:49 PM
    Author     : Tran Thuy Duong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<title>Handmade</title>
	<link rel="stylesheet" href="css_admin/style.css" type="text/css" media="all" />
        <script>
            function loadShowPro(){
                window.location="C_Pro_Admin?ProAction_ad=Show";
            }
            function confirmDelete(){
            
            
                var x = confirm("Bạn chắc chắn muốn xóa toàn bộ sản phẩm?");
                if(x==true)
                {
                    var xmlhttp;
                    if (window.XMLHttpRequest)
                      {// code for IE7+, Firefox, Chrome, Opera, Safari
                      xmlhttp=new XMLHttpRequest();
                      }
                    else
                      {// code for IE6, IE5
                      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                      }
                    xmlhttp.onreadystatechange=function()
                      {
                      if (xmlhttp.readyState==4 && xmlhttp.status==200)
                        {
                        document.getElementById("result_delete").innerHTML=xmlhttp.responseText;
                        }
                      }
                    xmlhttp.open("GET","C_Pro_Admin?ProAction_ad=DeleteAll",true);
                    xmlhttp.send();
                }
                
            }
        </script>
</head>
<body >
<!-- Header -->
<div id="header">
	<div class="shell">
		<!-- Logo + Top Nav -->
		<div id="top">
			<h1><a href="#">Handmade</a></h1>
			<div id="top-navigation">
				Xin chào <a href="#"><strong>Quản trị viên</strong></a>
				<span>|</span>
				<a href="#">Help</a>
				<span>|</span>
				<a href="#">Profile Settings</a>
				<span>|</span>
				<a href="#">Log out</a>
			</div>
		</div>
		<!-- End Logo + Top Nav -->
		
		<!-- Main Nav -->
		<div id="navigation">
			<ul>
			  <li><a href="C_Show_Customer" ><span>Khách hàng</span></a></li>
			    <li><a href="News.jsp"><span>Tin tức</span></a></li>
			    <li><a href="#"><span>Đơn hàng</span></a></li>
			    <li><a href="C_Show_Contact?ContactAction=Admin" ><span>Thông tin liên hệ</span></a></li>
			    <li><a href="#" class="active"><span>Sản phẩm</span></a></li>
			    <li><a href="#"><span>Services Control</span></a></li>
			</ul>
		</div>
		<!-- End Main Nav -->
	</div>
</div>
<!-- End Header -->

<!-- Container -->
<div id="container">
	<div class="shell">
		
		<!-- Small Nav -->
		<div class="small-nav">
			<a href="#">Khách hàng</a>
			<span>&gt;</span>
			Current Articles
		</div>
		<!-- End Small Nav -->
		
		
		
		
		<br />
		<!-- Main -->
		<div id="main">
			<div class="cl">&nbsp;</div>
			
			<!-- Content -->
			<div id="content">
				
				
				
				<!-- Box -->
				<div class="box">
					<!-- Box Head -->
					<div class="box-head">
						<h2>Thêm sản phẩm</h2>
					</div>
					<!-- End Box Head -->
                                        <%
                                            int masp = Integer.parseInt(request.getParameter("masp"));
                                            String tensp = request.getParameter("tensp");
                                            String nhacc = request.getParameter("nhacc");
                                            String madmsp= request.getParameter("madmsp");
                                            String mota = request.getParameter("mota");
                                            float giavon = Float.parseFloat(request.getParameter("giavon"));                 
                                            float giaban = Float.parseFloat(request.getParameter("giaban"));
                                            float khuyenmai = Float.parseFloat(request.getParameter("khuyenmai"));
                                            String trangthai = request.getParameter("trangthai");
                                            String hinhanh = request.getParameter("hinhanh");
                                        %>
					
					<form action="C_Pro_Admin" method="get">
						
						<!-- Form -->
						<div class="form">
                                                    <input type="hidden" name="masp" value="<%=masp%>"/>
								<p>
									<span class="req">max 100 symbols</span>
									<label>Tên sản phẩm<span>*</span></label>
                                                                        <input type="text" class="field size1" name="tensp" value="<%=tensp%>"/>
								</p>	
								<p class="inline-field">
									<label>Tên danh mục sản phẩm</label>
									<select class="field size2" name="madmsp" value="<%=madmsp%>">
										<option value="HMLD">Handmade làm đẹp</option>
										<option value="BHM">Bếp Handmade</option>
                                                                                <option value="QTHM">Quà tặng Handmade</option>
									</select>
									
								</p>
								
								<p>
									<span class="req">max 100 symbols</span>
									<label>Nhà cung cấp<span>*</span></label>
									<input type="text" class="field size1" name="nhacc" value="<%=nhacc%>"/>
								</p>
								
								<p>
									<span class="req">max 100 symbols</span>
									<label>Mô tả<span>*</span></label>
									<input type="text" class="field size1" name="mota" value="<%=mota%>"/>
								</p>

								<p>
									<span class="req">max 100 symbols</span>
									<label>Giá vốn<span>*</span></label>
									<input type="number" class="field size1" name="giavon" value="<%=giavon%>"/>
								</p>	
                                                                <p>
									<span class="req">max 100 symbols</span>
									<label>Giá bán<span>*</span></label>
									<input type="number" class="field size1" name="giaban" value="<%=giaban%>" />
								</p>
                                                                <p>
									<span class="req">max 100 symbols</span>
									<label>Khuyến mãi<span>*</span></label>
                                                                        <input type="number" class="field size1" name="khuyenmai" value="<%=khuyenmai%>"/>
								</p>
                                                                <p class="inline-field"  >
									<label>Trạng thái</label>
									<select class="field size2" rows="5" name="trangthai" >
                                                                            <%if(trangthai.equals("Con")) {%>
										<option value="Con">Còn hàng</option>
                                                                                <option value="Het">Hết hàng</option>
                                                                                <%} else {%>
										
                                                                                <option value="Het" >Hết hàng</option>
                                                                                <option value="Con" >Còn hàng</option><%}%>
                                                                                
									</select>
									
								</p>
                                                                <p>
									<label>Hình ảnh<span>*</span></label>
                                                                        <div><img src="images/pro/<%=hinhanh%>"  style="float: left;" alt="" height="125px" width="100px" alt="<%=hinhanh%>"/></div>
									<input type="file"  name="hinhanh" value="<%=hinhanh%>"/>
								</p>
							
						</div>
						<!-- End Form -->
						
						<!-- Form Buttons -->
						<div class="buttons">
                                                        
							<input type="submit" class="button" value="update" name="ProAction_ad" />
						</div>
						<!-- End Form Buttons -->
					</form>
				</div>
				<!-- End Box -->

			</div>
			<!-- End Content -->
			
			<!-- Sidebar -->
			<div id="sidebar">
				
				<!-- Box -->
				<div class="box">
					
					<!-- Box Head -->
					<div class="box-head">
						<h2>Management</h2>
					</div>
					<!-- End Box Head-->
					
					<div class="box-content">
						<a href="C_Pro_Show_Admin" class="add-button"><span>Thêm khách hàng</span></a>
						<div class="cl">&nbsp;</div>
						
						
                                                <p><a onclick="confirmDelete()">Delete Selected</a></p><p id="result_delete"></p>
						
						<!-- Sort -->
						<div class="sort">
							<label>Sort by</label>
							<select class="field">
								<option value="">Title</option>
							</select>
							<select class="field">
								<option value="">Date</option>
							</select>
							<select class="field">
								<option value="">Author</option>
							</select>
						</div>
						<!-- End Sort -->
						
					</div>
				</div>
				<!-- End Box -->
			</div>
			<!-- End Sidebar -->
			
			<div class="cl">&nbsp;</div>			
		</div>
		<!-- Main -->
	</div>
</div>
<!-- End Container -->

<!-- Footer -->
<div id="footer">
	<div class="shell">
		<span class="left">&copy; 2010 - CompanyName</span>
		<span class="right">
			Design by <a href="http://chocotemplates.com" target="_blank" title="The Sweetest CSS Templates WorldWide">Chocotemplates.com</a>
		</span>
	</div>
</div>
<!-- End Footer -->
	
</body>
</html>
